﻿using System;
using System.ComponentModel;
using Microsoft.Office.Interop.Word;

namespace Chapter13
{
    //使用命名索引器展示同义词数量
    [Description("Listing 13.11")]
    class WordMeanings
    {
        static void ShowInfo(SynonymInfo info)
        {
            Console.WriteLine("{0} has {1} meanings",
               info.Word, info.MeaningCount);
        }

        static void Main()
        {
            var app = new Application { Visible = false };

            //使用以前的C#语法
            object missing = Type.Missing;
            ShowInfo(app.get_SynonymInfo("painful", ref missing));
            //指定两个参数
            ShowInfo(app.SynonymInfo["nice", WdLanguageID.wdEnglishUS]);
            //使用可选参数
            ShowInfo(app.SynonymInfo[Word: "features"]);

            app.Application.Quit();
        }
    }
}
